#ifndef BLOB_H_INCLUDED
#define BLOB_H_INCLUDED

#include <vector>

#include "Environment.h"
#include "Joint.h"
#include "PointMass.h"
#include "Stick.h"

namespace BlobSalladDS
{
	class Blob
	{
		private:
			double x;
			double y;
			std::vector<Stick *> *sticks;
			std::vector<PointMass *> *pointMasses;
			std::vector<Joint *> *joints;
			PointMass *middlePointMass;
			double radius;
			int drawFaceStyle;
			int drawEyeStyle;
			bool selected;

			/**
			 * Generates a double between 0 and 1.
			 */
			double drand();
			int clampIndex(int index, int maxIndex);

		public:
			Blob(double x, double y, double radius, int numPointMasses);
			void addBlob(Blob &blob);
			PointMass *getMiddlePointMass();
			double getRadius();
			double getXPos();
			double getYPos();
			void scale(double scaleFactor);
			void move(double dt);
			void sc(Environment &env);
			void setForce(Vector *force);
			void addForce(Vector *force);
			void moveTo(double x, double y);
			void setSelected(bool selected);
			void drawEars(void * ctx, double scaleFactor);
			void drawHappyEyes1(void * ctx, double scaleFactor);
			void drawHappyEyes2(void * ctx, double scaleFactor);
			void drawHappyFace1(void * ctx, double scaleFactor);
			void drawHappyFace2(void * ctx, double scaleFactor);
			void drawOohFace(void * ctx, double scaleFactor);
			void drawFace(void * ctx, double scaleFactor);
			PointMass *getPointMass(int index);
			void drawBody(void * ctx, double scaleFactor);
			void drawSimpleBody(void * ctx, double scaleFactor);
			void draw(void * ctx, double scaleFactor);
	};
}

#endif // BLOB_H_INCLUDED
